load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

exports_files([
    "runnable_binary_wrapper.sh",
])

bzl_library(
    name = "cc_toolchain_util",
    srcs = ["cc_toolchain_util.bzl"],
    visibility = ["//foreign_cc:__subpackages__"],
    deps = [
        "@bazel_skylib//lib:collections",
        "@bazel_tools//tools/build_defs/cc:action_names.bzl",
        "@bazel_tools//tools/cpp:toolchain_utils.bzl",
    ],
)

bzl_library(
    name = "cmake_script",
    srcs = ["cmake_script.bzl"],
    visibility = ["//foreign_cc:__subpackages__"],
    deps = [":cc_toolchain_util"],
)

bzl_library(
    name = "configure_script",
    srcs = ["configure_script.bzl"],
    visibility = ["//foreign_cc:__subpackages__"],
    deps = [
        ":make_env_vars",
        ":make_script",
    ],
)

bzl_library(
    name = "framework",
    srcs = ["framework.bzl"],
    visibility = ["//foreign_cc:__subpackages__"],
    deps = [
        ":cc_toolchain_util",
        ":detect_root",
        ":run_shell_file_utils",
        "//foreign_cc:providers",
        "//foreign_cc/private/framework:helpers",
        "@bazel_skylib//lib:collections",
        "@bazel_skylib//lib:paths",
        "@bazel_tools//tools/cpp:toolchain_utils.bzl",
    ],
)

bzl_library(
    name = "make_env_vars",
    srcs = ["make_env_vars.bzl"],
    visibility = ["//foreign_cc:__subpackages__"],
    deps = [
        ":cc_toolchain_util",
        ":framework",
    ],
)

bzl_library(
    name = "make_script",
    srcs = ["make_script.bzl"],
    visibility = ["//foreign_cc:__subpackages__"],
    deps = [":make_env_vars"],
)

bzl_library(
    name = "transitions",
    srcs = ["transitions.bzl"],
    visibility = ["//foreign_cc:__subpackages__"],
    deps = ["//foreign_cc:providers"],
)

bzl_library(
    name = "detect_root",
    srcs = ["detect_root.bzl"],
    visibility = [
        "//foreign_cc:__subpackages__",
        "//test:__subpackages__",
    ],
)

bzl_library(
    name = "run_shell_file_utils",
    srcs = ["run_shell_file_utils.bzl"],
    visibility = ["//foreign_cc:__subpackages__"],
)
